cmake_minimum_required(VERSION 3.15)
project(hello_triangle C CXX)

find_package(glfw3 REQUIRED)
find_package(opengl_system REQUIRED)
find_package(glm REQUIRED)
find_package(plog REQUIRED)

set(GLAD_SRC ${CMAKE_SOURCE_DIR}/src/glad.c)

add_executable(shaders_uniform 1.shaders_uniform.cpp ${GLAD_SRC})
add_executable(shaders_interpolation 2.shaders_interpolation.cpp ${GLAD_SRC})
add_executable(shaders_class 3.shaders_class.cpp ${GLAD_SRC})

foreach(TARGET shaders_uniform shaders_interpolation shaders_class)
    target_include_directories(${TARGET} PRIVATE 
        ${CMAKE_SOURCE_DIR}/include
        ${CMAKE_SOURCE_DIR}/resource
    )

    target_link_libraries(${TARGET} glfw glm::glm plog::plog opengl32)
endforeach()

# 复制shader到bin目录
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/shader
     DESTINATION ${CMAKE_BINARY_DIR}/bin)
